﻿@model ElectronicDiary.Models.Teacher.SubjectClassSelectModel

@{
    ViewBag.Title = "Panel Nauczyciela";
}

<h2>Nauczyciel</h2>

@using (Html.BeginForm("Oceny", "Teacher", FormMethod.Get, new { cl = "cl", su = "su" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Wybierz przedmiot i klasę</legend>

        <div class="editor-field">
            @Html.DropDownListFor(
                n => n.IDSubject,
                new SelectList(Model.Subjects, "Value", "Text"),
                "-Wybierz-")
            @Html.ValidationMessageFor(model => model.IDSubject)
        </div>
        @Html.Hidden("cl")

        <div class="editor-field">
            @Html.DropDownListFor(
                n => n.IDClass,
                new SelectList(Model.Classes, "Value", "Text"),
                "-Wybierz-")
            @Html.ValidationMessageFor(model => model.IDClass)
        </div>
        @Html.Hidden("su")

        <p>
            <input type="submit" value="Pokaż" />
        </p>
    </fieldset>
}

<script type="text/javascript">
    $('#IDSubject').change(function () {
        var value = $(this).val();
        document.getElementById('su').value = value;
    });

    $('#IDClass').change(function () {
        var value = $(this).val();
        document.getElementById('cl').value = value;
    });
</script>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

